package com.zhc.community.dao;


import com.zhc.community.entity.Comment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CommentMapper {


    //查询某个帖子的所有评论
    List<Comment> selectCommentsByEntity(int entityType, int entityId, int offset, int limit);

    //查询评论数量
    int selectCountByEntity(int entityType, int entityId);

    int insertComment(Comment comment);

    //根据id查一条评论
    Comment selectCommentById(int id);

    int selectCountByUserId(@Param("entityType") int entityType, @Param("userId") int userId);

    List<Comment> selectCommentsByUserId(@Param("entityType") int entityType, @Param("userId") int userId, @Param("offset") int offset, @Param("limit") int limit);

    int deleteCommentById(@Param("id") int id);

}

